package com.frinder.seata.order.service;

import com.frinder.seata.data.base.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @ClassName CallStorageService
 * @Description 远程调用扣减库存服务
 * @Author frinder
 * @Date 2020/8/18 15:51
 * @Verion 1.0
 */
@FeignClient(value = "storage-server", fallbackFactory = CallStorageFallbackFactory.class)
public interface CallStorageService {

    /**
     * 扣减库存
     *
     * @param productId
     * @param qty
     * @return
     */
    @RequestMapping(value = "/biz/storage/decrease", method = RequestMethod.POST)
    Result decrease(@RequestParam long productId, @RequestParam int qty);

}
